import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

class widgetText extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new Scaffold(
      appBar: new AppBar(title: new Text("Text的使用")),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Text(
            "文字内容",
          ),
          Text(
            "文字样式设置参数   i am a simple",
            style: new TextStyle(
                //是否继承父组件的样式  例如在TextSpan Tree中
                inherit: true,
                //文字颜色
                color: const Color(0xffff0000),
                //指定绘制的paint
//                foreground: Paint(),
                //背景颜色
                backgroundColor: const Color(0xff00ff00),
                //指定背景
//                background: Paint(),
                //字体大小
                fontSize: 30,
                //加粗
                fontWeight: FontWeight.bold,
                //斜体
                fontStyle: FontStyle.italic,
                //字间距
                letterSpacing: 0.2,
                //单词间距
                wordSpacing: 0.2,
                //水平线
                textBaseline: TextBaseline.ideographic,
                //行高  倍数与fontSize
                height: 1.5,
                //文本装饰
                decorationColor: const Color(0xffff0000),
                //颜色
                decoration: TextDecoration.underline),

            //对齐方式
            textAlign: TextAlign.center,
            textDirection: TextDirection.rtl,
            softWrap: false,
            overflow: TextOverflow.ellipsis,
            //放大
            textScaleFactor: 2,
            maxLines: 2,
            textWidthBasis: TextWidthBasis.longestLine,
          ),
          RichText(
            text: TextSpan(
                text: '登录即同意',
                style: TextStyle(fontSize: 14, color: Colors.black),
                children: [
                  TextSpan(
                    text: '"服务条款"',
                    style: TextStyle(fontSize: 14, color: Colors.blue),
                    recognizer: TapGestureRecognizer()
                      ..onTap = () {
                        print('点击了服务条款');
                      },
                  ),
                  TextSpan(
                    text: '和',
                    style: TextStyle(fontSize: 14, color: Colors.black),
                  ),
                  TextSpan(
                    text: '"隐私政策"',
                    style: TextStyle(fontSize: 14, color: Colors.blue),
                    recognizer: TapGestureRecognizer()
                      ..onTap = () {
                        print('点击了隐私政策');
                      },
                  ),
                  WidgetSpan(
                    alignment: PlaceholderAlignment.middle,
                    child: Icon(Icons.check_circle_outline),
                  ),
                ]),
          ),
          Text.rich(TextSpan(
              text: '登录即同意',
              style: TextStyle(fontSize: 14, color: Colors.black),
              children: [
                TextSpan(
                  text: '"服务条款"',
                  style: TextStyle(fontSize: 14, color: Colors.blue),
                  recognizer: TapGestureRecognizer()
                    ..onTap = () {
                      print('点击了服务条款');
                    },
                ),
                TextSpan(
                  text: '和',
                  style: TextStyle(fontSize: 14, color: Colors.black),
                ),
                TextSpan(
                  text: '"隐私政策"',
                  style: TextStyle(fontSize: 14, color: Colors.blue),
                  recognizer: TapGestureRecognizer()
                    ..onTap = () {
                      print('点击了隐私政策');
                    },
                ),
                WidgetSpan(
                  alignment: PlaceholderAlignment.middle,
                  child: Icon(Icons.check_circle_outline),
                ),
              ]))
        ],
      ),
    );
  }
}
